package com.mervin.patterns.builder.other;

/***************************************
 * @Auther: mervin
 * @Date: 2020-04-18 01:18
 * @Description:
 ***************************************/
public class Man {
    private String name;
    private String sex;
    private String mobile;

    private Man(String name, String sex, String mobile) {
        super();
        this.name = name;
        this.sex = sex;
        this.mobile = mobile;
    }

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    @Override
    public String toString() {
        return "Man{" +
                "name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                ", mobile='" + mobile + '\'' +
                '}';
    }

    public static class Builder{
        private String name;
        private String sex;
        private String mobile;

        public Builder(){}
        public Man.Builder setName(String name){
            this.name = name;
            return this;
        }
        public Man.Builder setSex(String sex){
            this.sex = sex;
            return this;
        }

        public Man.Builder setMobile(String mobile){
            this.mobile = mobile;
            return this;
        }
        public Man buildConstract(){
            return new Man(this.name, this.sex, this.mobile);
        }
    }

}